import React, { useRef, useEffect } from 'react'
import * as echarts from 'echarts'



function Echart(props) {
    const map = useRef(null)
    useEffect(() => {
        const myChart = echarts.init(map.current)
        myChart.setOption(props.option)
        window.addEventListener('resize', () => {
            myChart.resize()
        })
    }, [])

    return (
        <div ref={map} id='main' style={{
            width: 400,
            height: 400
        }}>

        </div>
    )
}
export default Echart